import java.util.Scanner;

public class Test {
    public static int add(int x){
        int sum = 0;
        if(x<=9){
             sum += x;
        }else {
            sum += add(x/10) + x % 10;
        }
        return sum;

    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ret = add(n);
        System.out.println(ret);
    }
}
